<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:if test="${empty visitor ||visitor.adminGrade > 0}">
	<c:redirect url="wel!welcome.z" />
</c:if>

<head>
	<title>添加新用户</title>
	<script type="text/javascript">
	jq(function() {
		jq("button.valid").parents("form").validate({
			rules: {
			"user.username": {required: true,maxlength: 16},
			"user.password": {required: true,maxlength: 16},
			"password2": {required: true,maxlength: 16,equalTo: "#password"},
			"user.realname": {maxlength: 32},
			"user.email": {email: true,maxlength: 64}
			}
		});
	});
	</script>
</head>

<body>
	<form action="u!all.z" method="post" >
		<button type="submit" >
			返回列表
		</button>
	</form>
	
	<form action="u!add.z" method="post" class="center">
		<label>
			用户名<span class="notice">(必须，1-16个字符之间，区分大小写)</span>
			<br />
			<input type="text" name="user.username" />
			<br />
		</label>
		<label>
			密码<span class="notice">(必须，1-16个字符之间，区分大小写)</span>
			<br />
			<input type="password" name="user.password" id="password" />
			<br />
		</label>
		<label>
			重复密码<span class="notice">(必须，1-16个字符之间)</span>
			<br />
			<input type="password" name="password2" />
			
			<br />
		</label>
		<label>
			真名<span class="notice">(32个字符以内)</span>
			<br />
			<input type="text" name="user.realname" />
			<br />
		</label>
		<label>
			email<span class="notice">(64个字符以内)</span>
			<br />
			<input type="text" name="user.email" />
			<br />
		</label>
		<label>
			用户权限
		</label>
			<br />
			<input type='radio' name="user.adminGrade" value="2"
				checked="checked" />
			普通用户<span class="notice">（查看及增添未发布物料）</span>
			<br />
			<input type='radio' name="user.adminGrade" value="1" />
			超级用户<span class="notice">（可添加物料及BOM）</span>
			<br />
			<input type='radio' name="user.adminGrade" value="0" />
			管理员<span class="notice"></span>
			<br />

		<button type="submit" class="valid">
			保存
		</button>

	</form>
	
</body>